<!-- 知识图谱透视页 - Knowledge Graph Perspective -->
<template>
  <div class="knowledge-graph-perspective" @click.stop>
    <!-- 顶部标题栏 -->
    <div class="perspective-header">
      <div class="header-left">
        <h1 class="page-title">
          <el-icon class="title-icon"><Share /></el-icon>
          知识图谱透视
        </h1>
        <div class="subtitle">
          <el-tag type="success" size="small">实体关系</el-tag>
          <el-tag type="primary" size="small">语义分析</el-tag>
          <el-tag type="warning" size="small">智能溯源</el-tag>
        </div>
      </div>

      <div class="header-actions">
        <div class="action-buttons">
          <el-button 
            class="action-btn primary" 
            size="small" 
            @click="toggleFullscreen"
          >
            <el-icon><FullScreen /></el-icon>
            全屏模式
          </el-button>
          <el-button 
            class="action-btn primary" 
            size="small" 
            @click="saveLayout"
          >
            <el-icon><Collection /></el-icon>
            保存布局
          </el-button>
          <el-button 
            class="action-btn primary" 
            size="small" 
            @click="exportReport"
          >
            <el-icon><Download /></el-icon>
            导出报告
          </el-button>
          <el-button 
            class="action-btn primary" 
            size="small" 
            @click="refreshData"
          >
            <el-icon><Refresh /></el-icon>
            刷新数据
          </el-button>
        </div>
      </div>
    </div>

    <!-- 主要透视内容区域 -->
    <div class="perspective-content">
      <!-- 左侧：实体关系探索区域 -->
      <div class="left-section" :style="{ width: leftSectionWidth }">
        <div class="section-header">
          <h3 class="section-title">
            <el-icon><Connection /></el-icon>
            实体关系图谱
          </h3>
          <div class="section-controls">
            <el-tooltip content="展开/收起" placement="top">
              <el-button size="small" circle @click="toggleLeftSection">
                <el-icon>
                  <component :is="leftSectionExpanded ? 'Fold' : 'Expand'"></component>
                </el-icon>
              </el-button>
            </el-tooltip>
          </div>
        </div>
        
        <div class="section-content" v-show="leftSectionExpanded">
          <EntityRelationExplorer />
        </div>

        <!-- 调整器 -->
        <div
          class="section-resizer left-resizer"
          @mousedown="startResize('left', $event)"
        ></div>
      </div>

      <!-- 中央：3D可视化展示区域 -->
      <div class="center-section">
        <div class="visualization-container">
          <!-- 3D场景容器 -->
          <div ref="cesiumContainer" class="cesium-container"></div>
          
          <!-- 2D地图覆盖层 -->
          <div ref="mapContainer" class="map-overlay" v-show="show2DMap"></div>

          <!-- 可视化控制面板 -->
          <div class="viz-controls">
            <div class="control-panel">
              <div class="panel-section">
                <label>视图模式:</label>
                <el-radio-group v-model="viewMode" size="small" @change="switchViewMode">
                  <el-radio-button label="3d">3D地球</el-radio-button>
                  <el-radio-button label="2d">2D平面</el-radio-button>
                  <el-radio-button label="hybrid">混合视图</el-radio-button>
                </el-radio-group>
              </div>

              <div class="panel-section">
                <label>图层控制:</label>
                <div class="layer-controls">
                  <el-checkbox v-model="layers.signals" @change="toggleLayer('signals')">
                    信号覆盖
                  </el-checkbox>
                  <el-checkbox v-model="layers.threats" @change="toggleLayer('threats')">
                    威胁分布
                  </el-checkbox>
                  <el-checkbox v-model="layers.trajectories" @change="toggleLayer('trajectories')">
                    运动轨迹
                  </el-checkbox>
                  <el-checkbox v-model="layers.heatmap" @change="toggleLayer('heatmap')">
                    热力图
                  </el-checkbox>
                </div>
              </div>

              <div class="panel-section">
                <label>时间控制:</label>
                <el-slider
                  v-model="timeRange"
                  range
                  :min="0"
                  :max="24"
                  :step="0.5"
                  :marks="timeMarks"
                  @change="updateTimeFilter"
                ></el-slider>
              </div>

              <div class="panel-section">
                <label>频谱分析:</label>
                <div ref="spectrumChart" class="spectrum-chart"></div>
              </div>
            </div>
          </div>

          <!-- 状态指示器 -->
          <div class="status-indicators">
            <div class="indicator-item" :class="{ active: isStreaming }">
              <el-icon><VideoCamera /></el-icon>
              <span>实时流</span>
            </div>
            <div class="indicator-item" :class="{ active: isAnalyzing }">
              <el-icon><DataAnalysis /></el-icon>
              <span>AI分析</span>
            </div>
            <div class="indicator-item" :class="{ active: isTracking }">
              <el-icon><Position /></el-icon>
              <span>目标跟踪</span>
            </div>
          </div>
        </div>
      </div>

      <!-- 右侧：语义检索日志区域 -->
      <div class="right-section" :style="{ width: rightSectionWidth }">
        <div class="section-header">
          <h3 class="section-title">
            <el-icon><Document /></el-icon>
            语义分析日志
          </h3>
          <div class="section-controls">
            <el-tooltip content="展开/收起" placement="top">
              <el-button size="small" circle @click="toggleRightSection">
                <el-icon>
                  <component :is="rightSectionExpanded ? 'Fold' : 'Expand'"></component>
                </el-icon>
              </el-button>
            </el-tooltip>
          </div>
        </div>
        
        <div class="section-content" v-show="rightSectionExpanded">
          <SemanticSearchLog />
        </div>

        <!-- 调整器 -->
        <div
          class="section-resizer right-resizer"
          @mousedown="startResize('right', $event)"
        ></div>
      </div>
    </div>

    <!-- 底部状态栏 -->
    <div class="perspective-footer">
      <div class="status-left">
        <div class="status-item">
          <el-icon><DataLine /></el-icon>
          <span>实体节点: {{ entityCount }}</span>
        </div>
        <div class="status-item">
          <el-icon><Connection /></el-icon>
          <span>关系连接: {{ relationCount }}</span>
        </div>
        <div class="status-item">
          <el-icon><Timer /></el-icon>
          <span>分析耗时: {{ analysisTime }}ms</span>
        </div>
      </div>

      <div class="status-center">
        <div class="performance-meter">
          <span class="meter-label">系统负载:</span>
          <el-progress
            :percentage="systemLoad"
            :color="getLoadColor(systemLoad)"
            :stroke-width="8"
            :show-text="false"
          ></el-progress>
          <span class="meter-value">{{ systemLoad }}%</span>
        </div>
      </div>

      <div class="status-right">
        <div class="status-item">
          <el-icon><Clock /></el-icon>
          <span>最后更新: {{ lastUpdateTime }}</span>
        </div>
        <div class="status-item" :class="{ online: isOnline }">
          <el-icon><Connection /></el-icon>
          <span>{{ isOnline ? '在线' : '离线' }}</span>
        </div>
      </div>
    </div>

    <!-- WebGL时频图渲染器（隐藏元素用于3D渲染） -->
    <canvas ref="webglCanvas" style="display: none;"></canvas>
  </div>
</template>

<script setup>
import { ref, onMounted, onUnmounted, nextTick, computed } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import EntityRelationExplorer from './components/knowledge-graph/EntityRelationExplorer.vue'
import SemanticSearchLog from './components/knowledge-graph/SemanticSearchLog.vue'
import * as Cesium from 'cesium'
import * as echarts from 'echarts'

// 响应式数据
const isFullscreen = ref(false)
const leftSectionExpanded = ref(true)
const rightSectionExpanded = ref(true)
const leftSectionWidth = ref('16vw')
const rightSectionWidth = ref('16vw')
const viewMode = ref('3d')
const show2DMap = ref(false)
const timeRange = ref([8, 18])
const isStreaming = ref(true)
const isAnalyzing = ref(false)
const isTracking = ref(true)
const entityCount = ref(156)
const relationCount = ref(342)
const analysisTime = ref(1847)
const systemLoad = ref(65)
const isOnline = ref(true)

// DOM引用
const cesiumContainer = ref(null)
const mapContainer = ref(null)
const spectrumChart = ref(null)
const webglCanvas = ref(null)

// 图层控制
const layers = ref({
  signals: true,
  threats: true,
  trajectories: false,
  heatmap: false
})

// 时间标记
const timeMarks = ref({
  0: '00:00',
  6: '06:00',
  12: '12:00',
  18: '18:00',
  24: '24:00'
})

// Cesium viewer实例
let cesiumViewer = null
let spectrumChartInstance = null

// 计算属性
const centerSectionWidth = computed(() => {
  const leftWidth = leftSectionExpanded.value ? parseFloat(leftSectionWidth.value) : 3
  const rightWidth = rightSectionExpanded.value ? parseFloat(rightSectionWidth.value) : 3
  return `${100 - leftWidth - rightWidth}vw`
})

const lastUpdateTime = computed(() => {
  return new Date().toLocaleTimeString()
})

// 初始化Cesium 3D地球
const initCesium = async () => {
  if (!cesiumContainer.value) return

  try {
    cesiumViewer = new Cesium.Viewer(cesiumContainer.value, {
      terrainProvider: Cesium.createWorldTerrain(),
      homeButton: false,
      sceneModePicker: false,
      baseLayerPicker: false,
      navigationHelpButton: false,
      animation: false,
      timeline: false,
      fullscreenButton: false,
      geocoder: false,
      infoBox: false,
      selectionIndicator: false
    })

    // 设置初始视角到中国
    cesiumViewer.camera.setView({
      destination: Cesium.Cartesian3.fromDegrees(116.4074, 39.9042, 1000000),
      orientation: {
        heading: Cesium.Math.toRadians(0),
        pitch: Cesium.Math.toRadians(-45),
        roll: 0.0
      }
    })

    // 添加示例数据点
    addSampleEntities()

  } catch (error) {
    console.error('Cesium初始化失败:', error)
    ElMessage.error('3D地球初始化失败，请检查网络连接')
  }
}

// 添加示例实体
const addSampleEntities = () => {
  if (!cesiumViewer) return

  // 添加雷达站
  cesiumViewer.entities.add({
    position: Cesium.Cartesian3.fromDegrees(116.4074, 39.9042, 0),
    billboard: {
      image: '/src/assets/icons/radar-station.png',
      scale: 0.5,
      verticalOrigin: Cesium.VerticalOrigin.BOTTOM
    },
    label: {
      text: '雷达站A',
      font: '12pt sans-serif',
      pixelOffset: new Cesium.Cartesian2(0, -50),
      fillColor: Cesium.Color.WHITE,
      outlineColor: Cesium.Color.BLACK,
      outlineWidth: 2,
      style: Cesium.LabelStyle.FILL_AND_OUTLINE
    }
  })

  // 添加威胁信号覆盖范围
  cesiumViewer.entities.add({
    position: Cesium.Cartesian3.fromDegrees(116.4074, 39.9042, 0),
    ellipse: {
      semiMinorAxis: 50000,
      semiMajorAxis: 50000,
      material: Cesium.Color.RED.withAlpha(0.3),
      outline: true,
      outlineColor: Cesium.Color.RED,
      height: 1000
    }
  })
}

// 初始化频谱图表
const initSpectrumChart = () => {
  if (!spectrumChart.value) return

  spectrumChartInstance = echarts.init(spectrumChart.value)

  const option = {
    backgroundColor: 'transparent',
    grid: {
      left: '10%',
      right: '10%',
      top: '10%',
      bottom: '15%'
    },
    xAxis: {
      type: 'category',
      data: ['1200', '1400', '1600', '1800', '2000', '2200', '2400'],
      axisLabel: {
        color: '#ffffff',
        fontSize: 10
      },
      axisLine: {
        lineStyle: {
          color: '#ffffff'
        }
      }
    },
    yAxis: {
      type: 'value',
      axisLabel: {
        color: '#ffffff',
        fontSize: 10
      },
      axisLine: {
        lineStyle: {
          color: '#ffffff'
        }
      },
      splitLine: {
        lineStyle: {
          color: 'rgba(255, 255, 255, 0.1)'
        }
      }
    },
    series: [{
      data: [65, 78, 82, 90, 76, 68, 72],
      type: 'line',
      smooth: true,
      lineStyle: {
        color: '#4a90e2',
        width: 2
      },
      areaStyle: {
        color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
          { offset: 0, color: 'rgba(74, 144, 226, 0.5)' },
          { offset: 1, color: 'rgba(74, 144, 226, 0.1)' }
        ])
      }
    }]
  }

  spectrumChartInstance.setOption(option)
}

// 获取负载颜色
const getLoadColor = (load) => {
  if (load < 50) return '#67c23a'
  if (load < 80) return '#e6a23c'
  return '#f56c6c'
}

// 切换全屏
const toggleFullscreen = () => {
  if (!document.fullscreenElement) {
    document.documentElement.requestFullscreen()
    isFullscreen.value = true
  } else {
    document.exitFullscreen()
    isFullscreen.value = false
  }
}

// 保存布局
const saveLayout = () => {
  const layout = {
    leftWidth: leftSectionWidth.value,
    rightWidth: rightSectionWidth.value,
    leftExpanded: leftSectionExpanded.value,
    rightExpanded: rightSectionExpanded.value,
    viewMode: viewMode.value,
    layers: layers.value
  }
  
  localStorage.setItem('kg-perspective-layout', JSON.stringify(layout))
  ElMessage.success('布局已保存')
}

// 导出报告
const exportReport = async () => {
  try {
    await ElMessageBox.confirm('确定要导出知识图谱分析报告吗？', '确认导出', {
      type: 'info'
    })
    
    // 模拟导出过程
    ElMessage.info('正在生成报告...')
    
    setTimeout(() => {
      ElMessage.success('报告导出完成')
    }, 2000)
    
  } catch {
    // 用户取消
  }
}

// 刷新数据
const refreshData = () => {
  isAnalyzing.value = true
  
  // 模拟数据刷新
  setTimeout(() => {
    entityCount.value = Math.floor(Math.random() * 200) + 100
    relationCount.value = Math.floor(Math.random() * 400) + 200
    analysisTime.value = Math.floor(Math.random() * 1000) + 1000
    systemLoad.value = Math.floor(Math.random() * 40) + 40
    
    isAnalyzing.value = false
    ElMessage.success('数据已刷新')
  }, 1500)
}

// 切换左侧面板
const toggleLeftSection = () => {
  leftSectionExpanded.value = !leftSectionExpanded.value
  if (!leftSectionExpanded.value) {
    leftSectionWidth.value = '3vw'
  } else {
    leftSectionWidth.value = '16vw'
  }
}

// 切换右侧面板
const toggleRightSection = () => {
  rightSectionExpanded.value = !rightSectionExpanded.value
  if (!rightSectionExpanded.value) {
    rightSectionWidth.value = '3vw'
  } else {
    rightSectionWidth.value = '16vw'
  }
}

// 开始调整大小
const startResize = (section, event) => {
  event.preventDefault()
  
  const startX = event.clientX
  const startLeftWidth = parseFloat(leftSectionWidth.value)
  const startRightWidth = parseFloat(rightSectionWidth.value)
  
  const handleMouseMove = (e) => {
    const deltaX = e.clientX - startX
    const viewportWidth = window.innerWidth
    const deltaPercent = (deltaX / viewportWidth) * 100
    
    if (section === 'left') {
      const newWidth = Math.max(12, Math.min(35, startLeftWidth + deltaPercent))
      leftSectionWidth.value = `${newWidth}vw`
    } else {
      const newWidth = Math.max(12, Math.min(35, startRightWidth - deltaPercent))
      rightSectionWidth.value = `${newWidth}vw`
    }
  }
  
  const handleMouseUp = () => {
    document.removeEventListener('mousemove', handleMouseMove)
    document.removeEventListener('mouseup', handleMouseUp)
  }
  
  document.addEventListener('mousemove', handleMouseMove)
  document.addEventListener('mouseup', handleMouseUp)
}

// 切换视图模式
const switchViewMode = (mode) => {
  show2DMap.value = mode === '2d' || mode === 'hybrid'
  
  if (cesiumViewer) {
    if (mode === '2d') {
      cesiumViewer.scene.mode = Cesium.SceneMode.SCENE2D
    } else if (mode === '3d') {
      cesiumViewer.scene.mode = Cesium.SceneMode.SCENE3D
    }
  }
}

// 切换图层
const toggleLayer = (layerName) => {
  // 实现图层控制逻辑
  ElMessage.info(`图层 ${layerName} ${layers.value[layerName] ? '已启用' : '已禁用'}`)
}

// 更新时间过滤器
const updateTimeFilter = (range) => {
  ElMessage.info(`时间范围已更新: ${range[0]}:00 - ${range[1]}:00`)
}

// 加载保存的布局
const loadLayout = () => {
  const saved = localStorage.getItem('kg-perspective-layout')
  if (saved) {
    const layout = JSON.parse(saved)
    leftSectionWidth.value = layout.leftWidth || '16vw'
    rightSectionWidth.value = layout.rightWidth || '16vw'
    leftSectionExpanded.value = layout.leftExpanded !== false
    rightSectionExpanded.value = layout.rightExpanded !== false
    viewMode.value = layout.viewMode || '3d'
    if (layout.layers) {
      Object.assign(layers.value, layout.layers)
    }
  }
}

// 组件挂载后初始化
onMounted(async () => {
  loadLayout()
  
  await nextTick()
  
  // 延迟初始化以确保DOM完全渲染
  setTimeout(() => {
    initCesium()
    initSpectrumChart()
  }, 100)
  
  // 监听全屏变化
  document.addEventListener('fullscreenchange', () => {
    isFullscreen.value = !!document.fullscreenElement
  })
})

// 组件卸载时清理
onUnmounted(() => {
  if (cesiumViewer) {
    cesiumViewer.destroy()
  }
  if (spectrumChartInstance) {
    spectrumChartInstance.dispose()
  }
})
</script>

<style scoped>
/* 适配侧边栏布局的样式 */
* {
  box-sizing: border-box;
}

.knowledge-graph-perspective {
  width: 96vw;
  height: 100vh;
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Microsoft YaHei', sans-serif;
  position: absolute;
  top: 0;
  left: 4vw;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.perspective-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5vh 2vw;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(15px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  z-index: 1000;
}

.header-left {
  display: flex;
  flex-direction: column;
  gap: 1vh;
}

.page-title {
  color: #ffffff;
  font-size: 2.2rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 1vw;
  font-weight: 600;
}

.title-icon {
  font-size: 2rem;
  color: #4a90e2;
}

.subtitle {
  display: flex;
  gap: 1vw;
}

.header-actions {
  margin-right: 5vw;
  margin-left: -3vw;
}

.action-buttons {
  display: flex;
  gap: 1vw;
  align-items: center;
}

.action-btn {
  background: linear-gradient(135deg, #4a90e2, #74b9ff) !important;
  border: 1px solid rgba(74, 144, 226, 0.8) !important;
  color: #ffffff !important;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  border-radius: 0.6vh !important;
  padding: 0.8vh 1.5vw !important;
  font-weight: 600;
  box-shadow: 0 3px 15px rgba(74, 144, 226, 0.4);
  position: relative;
  overflow: hidden;
}

.action-btn:hover {
  background: linear-gradient(135deg, #357abd, #5a9bd4) !important;
  border-color: #357abd !important;
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 20px rgba(74, 144, 226, 0.6);
}

.action-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.action-btn:hover::before {
  left: 100%;
}

.action-btn.primary {
  background: linear-gradient(135deg, #4a90e2, #74b9ff) !important;
  border: 1px solid rgba(74, 144, 226, 0.8) !important;
  box-shadow: 0 3px 15px rgba(74, 144, 226, 0.4);
  color: #ffffff !important;
  font-weight: 600;
}

.action-btn.primary:hover {
  background: linear-gradient(135deg, #357abd, #5a9bd4) !important;
  border-color: rgba(53, 122, 189, 0.9) !important;
  box-shadow: 0 6px 25px rgba(74, 144, 226, 0.6);
  transform: translateY(-2px) scale(1.05);
}

.action-btn.primary::before {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
}

.action-btn .el-icon {
  margin-right: 0.4vw;
  font-size: 1rem;
  transition: transform 0.3s ease;
}

.action-btn:hover .el-icon {
  transform: scale(1.1);
}

.perspective-content {
  flex: 1;
  display: flex;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
}

.left-section,
.right-section {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: width 0.3s ease;
  min-width: 15vw;
  max-width: 25vw;
  overflow: hidden;
  flex-shrink: 0;
  flex-grow: 0;
  box-sizing: border-box;
}

.left-section {
  border-right: none;
}

.right-section {
  border-left: none;
}

.center-section {
  flex: 1;
  background: rgba(0, 0, 0, 0.2);
  position: relative;
  overflow: hidden;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2vh 2vw;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.2);
}

.section-title {
  color: #ffffff;
  font-size: 1.2rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.8vw;
}

.section-content {
  flex: 1;
  overflow: visible;
  padding: 0;
  margin: 0;
  width: 100%;
  height: 100%;
}

.section-resizer {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0.5vw;
  background: rgba(255, 255, 255, 0.1);
  cursor: col-resize;
  z-index: 10;
  transition: background 0.3s ease;
}

.section-resizer:hover {
  background: rgba(74, 144, 226, 0.5);
}

.left-resizer {
  right: 0;
}

.right-resizer {
  left: 0;
}

.visualization-container {
  width: 100%;
  height: 100%;
  position: relative;
}

.cesium-container {
  width: 100%;
  height: 100%;
}

.map-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
}

.viz-controls {
  position: absolute;
  top: 2vh;
  left: 1vw;
  width: 16vw;
  max-width: 280px;
  min-width: 200px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  border-radius: 1vh;
  border: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 100;
}

.control-panel {
  padding: 2vh;
}

.panel-section {
  margin-bottom: 2vh;
}

.panel-section label {
  display: block;
  color: #ffffff;
  font-size: 0.9rem;
  margin-bottom: 1vh;
  font-weight: 500;
}

.layer-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1vh;
}

.spectrum-chart {
  width: 100%;
  height: 15vh;
  margin-top: 1vh;
}

.status-indicators {
  position: absolute;
  top: 2vh;
  right: 2vw;
  display: flex;
  flex-direction: column;
  gap: 1vh;
  z-index: 100;
}

.indicator-item {
  display: flex;
  align-items: center;
  gap: 0.5vw;
  padding: 1vh 1.5vw;
  background: rgba(0, 0, 0, 0.6);
  color: #bdc3c7;
  border-radius: 0.5vh;
  font-size: 0.8rem;
  transition: all 0.3s ease;
}

.indicator-item.active {
  background: rgba(74, 144, 226, 0.8);
  color: #ffffff;
  box-shadow: 0 0 1vh rgba(74, 144, 226, 0.5);
}

.perspective-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5vh 3vw;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.status-left,
.status-right {
  display: flex;
  gap: 3vw;
}

.status-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 0.5vw;
  font-size: 0.9rem;
  color: #bdc3c7;
}

.status-item.online {
  color: #67c23a;
}

.performance-meter {
  display: flex;
  align-items: center;
  gap: 1vw;
}

.meter-label {
  font-size: 0.9rem;
  color: #bdc3c7;
}

.meter-value {
  font-size: 0.9rem;
  color: #ffffff;
  font-weight: 500;
  min-width: 3vw;
}

/* 深色主题适配 */
:deep(.el-radio-button__inner) {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

:deep(.el-radio-button__orig-radio:checked + .el-radio-button__inner) {
  background-color: #4a90e2;
  border-color: #4a90e2;
  color: #ffffff;
}

:deep(.el-checkbox__inner) {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
}

:deep(.el-checkbox__input.is-checked .el-checkbox__inner) {
  background-color: #4a90e2;
  border-color: #4a90e2;
}

:deep(.el-slider__runway) {
  background-color: rgba(255, 255, 255, 0.2);
}

:deep(.el-slider__bar) {
  background-color: #4a90e2;
}

:deep(.el-slider__button) {
  border-color: #4a90e2;
}

/* 响应式设计 */
@media (max-width: 1600px) {
  .viz-controls {
    width: 18vw;
    max-width: 260px;
  }
  
  .left-section,
  .right-section {
    min-width: 18vw;
  }
}

@media (max-width: 1400px) {
  .viz-controls {
    width: 20vw;
    max-width: 240px;
  }
  
  .left-section,
  .right-section {
    min-width: 16vw;
  }
}

@media (max-width: 1200px) {
  .viz-controls {
    width: 22vw;
    max-width: 220px;
  }
  
  .status-left,
  .status-right {
    gap: 1.5vw;
  }
  
  .left-section,
  .right-section {
    min-width: 14vw;
  }
  
  .perspective-header {
    padding: 1.5vh 2vw;
  }
}

@media (max-width: 1200px) {
  .action-buttons {
    gap: 0.8vw;
  }
  
  .action-btn {
    padding: 0.6vh 1.2vw !important;
    font-size: 0.9rem;
  }
}

@media (max-width: 768px) {
  .page-title {
    font-size: 1.6rem;
  }
  
  .viz-controls {
    width: 30vw;
    max-width: 180px;
    left: 0.5vw;
  }
  
  .perspective-footer {
    flex-direction: column;
    gap: 1vh;
    padding: 1vh 2vw;
  }
  
  .left-section,
  .right-section {
    min-width: 12vw;
  }
  
  .perspective-header {
    padding: 1vh 1.5vw;
    flex-direction: column;
    gap: 1vh;
    align-items: flex-start;
  }
  
  .header-actions {
    margin-right: 2vw;
    margin-left: 0;
  }
  
  .action-buttons {
    flex-wrap: wrap;
    gap: 0.5vw;
    width: 100%;
    justify-content: flex-start;
  }
  
  .action-btn {
    padding: 0.5vh 1vw !important;
    font-size: 0.8rem;
    min-width: auto;
  }
  
  .action-btn .el-icon {
    margin-right: 0.3vw;
  }
}
</style>